package com.ltkj.coupon.service.impl;

import java.util.List;
import com.ltkj.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ltkj.coupon.mapper.TCouponRuleMapper;
import com.ltkj.coupon.domain.TCouponRule;
import com.ltkj.coupon.service.ITCouponRuleService;

/**
 * 优惠券规则Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-21
 */
@Service
public class TCouponRuleServiceImpl implements ITCouponRuleService 
{
    @Autowired
    private TCouponRuleMapper tCouponRuleMapper;

    /**
     * 查询优惠券规则
     * 
     * @param id 优惠券规则主键
     * @return 优惠券规则
     */
    @Override
    public TCouponRule selectTCouponRuleById(Long id)
    {
        return tCouponRuleMapper.selectTCouponRuleById(id);
    }

    /**
     * 查询优惠券规则列表
     * 
     * @param tCouponRule 优惠券规则
     * @return 优惠券规则
     */
    @Override
    public List<TCouponRule> selectTCouponRuleList(TCouponRule tCouponRule)
    {
        return tCouponRuleMapper.selectTCouponRuleList(tCouponRule);
    }

    /**
     * 新增优惠券规则
     * 
     * @param tCouponRule 优惠券规则
     * @return 结果
     */
    @Override
    public int insertTCouponRule(TCouponRule tCouponRule)
    {
        tCouponRule.setCreateTime(DateUtils.getNowDate());
        return tCouponRuleMapper.insertTCouponRule(tCouponRule);
    }

    /**
     * 修改优惠券规则
     * 
     * @param tCouponRule 优惠券规则
     * @return 结果
     */
    @Override
    public int updateTCouponRule(TCouponRule tCouponRule)
    {
        tCouponRule.setUpdateTime(DateUtils.getNowDate());
        return tCouponRuleMapper.updateTCouponRule(tCouponRule);
    }

    /**
     * 批量删除优惠券规则
     * 
     * @param ids 需要删除的优惠券规则主键
     * @return 结果
     */
    @Override
    public int deleteTCouponRuleByIds(Long[] ids)
    {
        return tCouponRuleMapper.deleteTCouponRuleByIds(ids);
    }

    /**
     * 删除优惠券规则信息
     * 
     * @param id 优惠券规则主键
     * @return 结果
     */
    @Override
    public int deleteTCouponRuleById(Long id)
    {
        return tCouponRuleMapper.deleteTCouponRuleById(id);
    }
}
